import  {defineStore} from 'pinia'
import axios from "axios";
import { nanoid } from "nanoid";
import { reactive } from 'vue';

export const useTalkStore = defineStore('talk',()=>{
    const talkList = reactive(
        JSON.parse(localStorage.getItem('talkList') as string) || []
    )

    async function getATalk() {
        let {data:{content:title}} = await axios.get('http')
        let obj = {id:nanoid(),title}
        talkList.unshift(obj)
    }
    return {talkList,getATalk}
})